#!/bin/bash

GUNPATH=`pwd | rev | cut -d"/" -f 4- | rev`
SETUPS="75views"
QUERIES="9"
PH=$GUNPATH/code/expfiles/berlinOutput

cp configD.properties.base configD.properties
sed -i".bkp" "s|GUNPATH|$GUNPATH|" configD.properties
for setup in $SETUPS ;do
    sed -i".bkp" "s/[0-9][0-9]*views/$setup/" configD.properties
    for i in $QUERIES ;do
        sed -i".bkp" "s/query[0-9][0-9]*/query$i/" configD.properties
        java -XX:MaxHeapSize=2048m -cp ".:../lib2/*" experimentseswc/evaluateQuery configD.properties
        java processFile $PH/$setup/outputRelViewsquery${i}/NOTHING/modelSize $PH/$setup/outputRelViewsquery${i}/NOTHING/modelSizes
        rm $PH/$setup/outputRelViewsquery${i}/NOTHING/modelSize
        java processAnswers $PH/${setup}/ outputRelViewsquery${i}
        java deleteAnswers $PH/${setup}/ outputRelViewsquery${i} 
    done
done
rm configD.properties.bkp
rm configD.properties
java processNewResults $PH/${setup}/ outputRelViews $PH/results${setup}.dat
